package com.njxxted.activiti.modules.process.extend.controller;

import com.njxxted.activiti.common.response.ResponseVo;
import com.njxxted.activiti.common.util.PageUtil;
import com.njxxted.activiti.modules.base.controller.BaseController;
import com.njxxted.activiti.modules.process.extend.entity.ExtendActCopyEntity;
import com.njxxted.activiti.modules.process.extend.service.ExtendActCopyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 描述：流程抄送表 exception
 * <p>
 * 作者：HuTongFu
 * 邮箱：hu_tongfu@163.com
 * 时间：2019-08-19 10:07:17
 */
@Api(tags = "流程抄送")
@RestController
@RequestMapping("extend/act/copy")
public class ExtendActCopyController extends BaseController {

    @Resource
    private ExtendActCopyService extendActCopyService;

    @ApiOperation(value = "分页查询")
    @GetMapping("/")
    public ResponseVo list(ExtendActCopyEntity param) {
        PageUtil<ExtendActCopyEntity> extendActCopyList = extendActCopyService.queryList(param);
        return ResponseVo.ok(extendActCopyList);
    }

    @ApiOperation(value = "根据主键id查询")
    @GetMapping("/{id}")
    public ResponseVo info(@PathVariable("id") String id) {
        ExtendActCopyEntity extendActCopyEntity = extendActCopyService.queryObject(id);
        return ResponseVo.ok(extendActCopyEntity);
    }

    @ApiOperation(value = "保存")
    @PostMapping("/")
    public ResponseVo save(ExtendActCopyEntity param) {
        int i = extendActCopyService.save(param);
        if (i > 0)
            return ResponseVo.ok();
        else
            return ResponseVo.error();
    }

    @ApiOperation(value = "修改")
    @PutMapping("/")
    public ResponseVo update(ExtendActCopyEntity extendActCopyEntity) {
        int i = extendActCopyService.update(extendActCopyEntity);
        if (i > 0)
            return ResponseVo.ok();
        else
            return ResponseVo.error();
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("/")
    public ResponseVo delete(String[] ids) {
        int i = extendActCopyService.deleteBatch(ids);
        if (i > 0)
            return ResponseVo.ok();
        else
            return ResponseVo.error();
    }

}
